/*
*          iMaple by KururuLABO
*/

package iMaple.Packet;

import client.MapleCharacter;
import handling.SendPacketOpcode;
import java.util.List;
import tools.data.MaplePacketLittleEndianWriter;

public class ShowAllCharacter {

        public static byte[] ShowAllCharacter(int worldid, List<MapleCharacter> chars, String pic) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
        mplew.writeShort(SendPacketOpcode.ALL_CHARLIST.getValue());
        mplew.write(chars.size() == 0 ? 5 : 0); //5 = cannot find any
        mplew.write(worldid);
        mplew.write(chars.size());
        for (MapleCharacter chr : chars) {
            CharlistRequest.addCharEntry(mplew, chr,true);
        }
        mplew.write(pic == null ? 0 : (pic.equals("") ? 2 : 1)); //writing 2 here disables PIC		
        return mplew.getPacket();
    }
}
